package cn.edu.scau.cmi.xiaowenyang.comprehensiveExperiment;

import java.net.URL;
import java.util.ResourceBundle;

import cn.edu.scau.cmi.xiaowenyang.client.AbstractFactoryMethodClient;
import cn.edu.scau.cmi.xiaowenyang.client.ClassAdapterMethodClient;
import cn.edu.scau.cmi.xiaowenyang.client.ConsistentCompositePatternClient;
import cn.edu.scau.cmi.xiaowenyang.client.FactoryMethodClient;
import cn.edu.scau.cmi.xiaowenyang.client.MultitonPatternClient;
import cn.edu.scau.cmi.xiaowenyang.client.ObjectAdapterMethodClient;
import cn.edu.scau.cmi.xiaowenyang.client.SafeCompositePatternClient;
import cn.edu.scau.cmi.xiaowenyang.client.SingletonPatternClient;
import cn.edu.scau.cmi.xiaowenyang.client.StaticFactoryMethodClient;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.control.Button;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
import javafx.stage.Stage;

public class ComprehensiveExperimentController implements Initializable {
	@FXML
	private ImageView imageView;
	@FXML
	private Button button1;
	@FXML
	private Button button2;
	@FXML
	private Button button3;
	@FXML
	private Button button4;
	@FXML
	private Button button5;
	@FXML
	private Button button6;
	@FXML
	private Button button7;
	@FXML
	private Button button8;
	@FXML
	private Button button9;

	@Override
	public void initialize(URL location, ResourceBundle resources) {
		// TODO Auto-generated method stub
		imageView.setImage(new Image("natsuiromatsuri.jpg"));

		button1.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			SingletonPatternClient client = new SingletonPatternClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button2.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			MultitonPatternClient client = new MultitonPatternClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button3.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			StaticFactoryMethodClient client = new StaticFactoryMethodClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button4.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			FactoryMethodClient client = new FactoryMethodClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button5.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			AbstractFactoryMethodClient client = new AbstractFactoryMethodClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button6.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			ObjectAdapterMethodClient client = new ObjectAdapterMethodClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button7.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			ClassAdapterMethodClient client = new ClassAdapterMethodClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button8.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			SafeCompositePatternClient client = new SafeCompositePatternClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});

		button9.setOnMouseClicked(e -> {
			Stage stage = new Stage();
			ConsistentCompositePatternClient client = new ConsistentCompositePatternClient();
			try {
				client.start(stage);
			} catch (Exception e1) {
				// TODO Auto-generated catch block
				e1.printStackTrace();
			}
		});
	}

}
